<%@page language="Java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@include file="includes/head.jsp" %>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Transaction</title>
</head>
<body>
	<f:view>
		<span id="whole-page-wrapper">
			<div id="wrapper" align="center">
			<%@include file="includes/header.jsp" %>
			<%@include file="includes/menu.jsp" %>	
					
				<div id="content">
					<div id="inner-content">
					<c:if test="${sessionScope.user.loggedUser.type == 'Admin' }">
						<h3>Szczegółowe dane telefonu</h3>
						
							<div class="leftIndent50px">
								<h4> ID zamówienia: </h4>
									<span class="leftIndent30px"><h:outputText value="#{order.selectedOrder.id }"/></span><br>
								<h4> Data: </h4>
									<span class="leftIndent30px"><h:outputText value="#{order.selectedOrder.date }"/></span><br>
								<h4> Status: </h4>
									<span class="leftIndent30px">
										<c:if test="${order.selectedOrder.status == 'Waiting'}">
											Oczekujące
										</c:if>
										<c:if test="${order.selectedOrder.status == 'In progress'}">
											W doręczeniu
										</c:if>
										<c:if test="${order.selectedOrder.status == 'Finished'}">
											Zrealizowane
										</c:if>
									</span><br>
								<h4> Ilość produktów: </h4>
									<span class="leftIndent30px">${order.selectedOrder.phones.size()}</span><br>
								<c:if test="${user.loggedUser.type == 'Admin' }">
									<h:form>
										<h3> Oznacz zamówienie jako: </h3>
										<h:selectOneMenu value="#{order.selectedOrder.status }">
											<f:selectItem itemLabel="Oczekujące" itemValue="Waiting" />
											<f:selectItem itemLabel="W doręczeniu" itemValue="In progress" />
											<f:selectItem itemLabel="Zrealizowane" itemValue="Finished" />
										</h:selectOneMenu>
										
										<h:commandButton value="Aktualizuj" action="#{order.updateOrderStatus}"/>
									</h:form>
								</c:if>
							</div>
					</c:if>
					<c:if test="${sessionScope.user.loggedUser.type == 'User' }">
						<h3>Szczegółowe dane telefonu</h3>
						
							<div class="leftIndent50px">
								<h4> ID zamówienia: </h4>
									<span class="leftIndent30px"><h:outputText value="#{order.selectedOrder.id }"/></span><br>
								<h4> Data: </h4>
									<span class="leftIndent30px"><h:outputText value="#{order.selectedOrder.date }"/></span><br>
								<h4> Status: </h4>
									<span class="leftIndent30px">
										<c:if test="${order.selectedOrder.status == 'Waiting'}">
											Oczekujące
										</c:if>
										<c:if test="${order.selectedOrder.status == 'In progress'}">
											W doręczeniu
										</c:if>
										<c:if test="${order.selectedOrder.status == 'Finished'}">
											Zrealizowane
										</c:if>
									</span><br>
								<h4> Ilość produktów: </h4>
									<span class="leftIndent30px">${order.selectedOrder.phones.size()}</span><br>
							</div>
					</c:if>
					<c:if test="${sessionScope.user.loggedUser == null }">
						Nie masz uprawnień do korzystania z tej strony!
					</c:if>	
					</div>
				</div>
				<%@include file="includes/footer.jsp" %>
			</div>
		</span>
	</f:view>
</body>
</html>